// ignore_for_file: dangling_library_doc_comments, slash_for_doc_comments
/*** 
 * @Author: Zhong
 * @Date: 2025-03-07 16:34:19
 * @LastEditors: Zhong zhongxiaodong@eenet.com
 * @LastEditTime: 2025-07-15 15:18:53
 * @FilePath: /wan_android_flutter/lib/common_code/tabbar/bottom_nav_tabbar.dart
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart';
import 'package:wan_android_flutter/common_code/configs/app_color_config.dart';

import '../../module_code/home/pages/home_page.dart';
import '../../module_code/mine/pages/mine_page.dart';
import '../../module_code/project/pages/project_page.dart';
import '../../module_code/short_video/pages/short_video_page.dart';

class BottomNavTabbar extends StatelessWidget {
  // 路由名称
  static const String routeName = '/bottom_nav_tabbar';
  BottomNavTabbar({super.key});
  final PersistentTabController _controller = PersistentTabController();

  //Tab页面
  List<PersistentTabConfig> _tabs() => [
    PersistentTabConfig(
      screen: const HomePage(),
      item: ItemConfig(
        icon: const Icon(Icons.home),
        title: "首页",
        activeForegroundColor: Colors.blue,
        inactiveForegroundColor: Colors.grey,
      ),
    ),
    PersistentTabConfig(
      screen: const ProjectPage(),
      item: ItemConfig(
        icon: const Icon(Icons.photo_library_outlined),
        title: "相册",
        activeForegroundColor: Colors.blue,
        inactiveForegroundColor: Colors.grey,
      ),
    ),
    PersistentTabConfig(
      screen: const ShortVideoPage(),
      item: ItemConfig(
        icon: const Icon(Icons.live_tv_sharp),
        title: "短视频",
        activeForegroundColor: Colors.blue,
        inactiveForegroundColor: Colors.grey,
      ),
    ),
    PersistentTabConfig(
      screen: const MinePage(),
      item: ItemConfig(
        icon: const Icon(Icons.person_pin_outlined),
        title: "我的",
        activeForegroundColor: Colors.blue,
        inactiveForegroundColor: Colors.grey,
      ),
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return PersistentTabView(
      controller: _controller,
      tabs: _tabs(),
      navBarBuilder: (navBarConfig) => Style2BottomNavBar(
        navBarConfig: navBarConfig,
        navBarDecoration: NavBarDecoration(
          borderRadius: BorderRadius.circular(10),
        ),
      ),
      backgroundColor: AppColorConfig.backgroundColor,
    );
  }
}
